// 
// Copyright 2010 Classpath Pty Ltd <opensource@classpath.com.au>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 

using build

**
** Tests the `CanUseColumnType` mixin.
**
internal class CanUseColumnTypeTest : Test
{

    **
    ** Stores an instance of `CanUseColumnType` for testing.
    **
    CanUseColumnType? canUseColumnType

    **
    ** Performs additional setup needed for `CanUseColumnTypeTest`.
    **
    override Void setup()
    {
        super.setup()
        canUseColumnType = CanUseColumnTypeTestClass()
    }

    **
    ** Cleans up additional setup needed for `CanUseColumnTypeTest`.
    **
    override Void teardown()
    {
        super.teardown()
        canUseColumnType = null
    }

    **
    ** Tests the `CanUseColumnType.blob` method.
    **
    Void testBlob() {
        type := canUseColumnType.blob
        verifyEq(BlobType#, type.typeof)
    }

    **
    ** Tests the `CanUseColumnType.char` method.
    **
    Void testChar() {
        type := canUseColumnType.char(1234)
        verifyEq(CharType#, type.typeof)
        verifyEq(1234, type.length)
    }

    **
    ** Tests the `CanUseColumnType.date` method.
    **
    Void testDate() {
        type := canUseColumnType.date
        verifyEq(DateType#, type.typeof)
    }

    **
    ** Tests the `CanUseColumnType.decimal` method.
    **
    Void testDecimal() {
        type := canUseColumnType.decimal(1234, 5678)
        verifyEq(DecimalType#, type.typeof)
        verifyEq(1234, type.precision)
        verifyEq(5678, type.scale)
    }

    **
    ** Tests the `CanUseColumnType.float` method.
    **
    Void testFloat() {
        type := canUseColumnType.float(1234, 5678)
        verifyEq(FloatType#, type.typeof)
        verifyEq(1234, type.precision)
        verifyEq(5678, type.scale)
    }

    **
    ** Tests the `CanUseColumnType.int` method.
    **
    Void testInteger() {
        type := canUseColumnType.integer(1234)
        verifyEq(IntegerType#, type.typeof)
        verifyEq(1234, type.precision)
    }

    **
    ** Tests the `CanUseColumnType.serial` method.
    **
    Void testSerial() {
        type := canUseColumnType.serial
        verifyEq(SerialType#, type.typeof)
    }

    **
    ** Tests the `CanUseColumnType.text` method.
    **
    Void testText() {
        type := canUseColumnType.text
        verifyEq(TextType#, type.typeof)
    }

    **
    ** Tests the `CanUseColumnType.timestamp` method.
    **
    Void testTimestamp() {
        type := canUseColumnType.timestamp
        verifyEq(TimestampType#, type.typeof)
    }

    **
    ** Tests the `CanUseColumnType.time` method.
    **
    Void testTime() {
        type := canUseColumnType.time
        verifyEq(TimeType#, type.typeof)
    }

    **
    ** Tests the `CanUseColumnType.varchar` method.
    **
    Void testVarchar() {
        type := canUseColumnType.varchar(1234)
        verifyEq(VarcharType#, type.typeof)
        verifyEq(1234, type.length)
    }

}

**
** Provides a simple implementation of `CanUseColumnType` for testing.
**
internal class CanUseColumnTypeTestClass : CanUseColumnType {
}
